﻿using System;
using System.Collections.Generic;

namespace Demos.MFSets
{
    class TestClass : IEquatable<TestClass>
    {
        private int _cant;
        private List<string> _lista;

        public TestClass()
        {
            _lista = new List<string>();
            var r = new Random();
            _cant = r.Next(1, 20);
            for (int i = 0; i < _cant; i++)
            {
                _lista.Add(r.Next().ToString());
            }
        }

        public bool Equals(TestClass other)
        {
            return Equals(other._cant);
        }

        public override int GetHashCode()
        {
            int hash=0;
            foreach (var item in _lista)
            {
                hash += (int)Math.Pow(double.Parse(item), _cant);
            }
            return _cant+hash;
        }
    }
}
